<?php
	header("Content-Type: text/html; charset=UTF-8");
	
	function traverse($path) {
		$dir = array(
			'01' => 'Images/01/',
			'02' => 'Images/02/',
			'03' => 'Images/03/',
			'04' => 'Images/04/',
			'05' => 'Images/05/',
			'06' => 'Images/06/',
			'07' => 'Images/07/'
		);
			
		$current_dir = opendir('../'.$dir[$path]);    //opendir()返回一个目录句柄,失败返回false
		while(($file = readdir($current_dir)) !== false) {    //readdir()返回打开目录句柄中的一个条目
			$sub_dir = $path . DIRECTORY_SEPARATOR . $file;    //构建子目录路径
			if($file == '.' || $file == '..') {
				continue;
			} else {
				//如果是文件,直接输出
				$result[] = $dir[$path].$file;
			}
		}
		
		return $result;
	}
	
	$path = @$_GET['path'];
	if(empty($path)){
		$path = '01';
	}
	
	$result = traverse($path);
	if(empty($result)){
		$result['status'] = 0;
	}
	
	echo json_encode($result);
?>